auto.waitFor(); //
let width = device.width;
let height = device.height;
FloatyUtil(); //=悬浮窗加载===
init();
toastLog("版本24.7.16");
sleep(400);
// 滑块验证();
// android.os.Process.killProcess(android.os.Process.myPid());
// 掌上武义f();
// 爱盐海f();
// 望潮阅读();

望潮f();
// 竞舟f();

// 西施眼f();
// 滑块验证();
// findAndClick("抽奖.*", 8000, 1000, true);
// findAndClick("阅读.*");
// exit();

exit();
function 滑块验证() {
  const permissionsScreenshot = screenshotRequest();
  if (!requestScreenCapture()) {
    toast("请求截图失败");
    exit();
  }
  permissionsScreenshot && permissionsScreenshot.interrupt();
  sleep(2000);
  aaa();
}

function aaa() {
  img = captureScreen();
  // var 原图 = images.clip(img, 129, 924, 800, 540);
  // 转为灰度图
  let gray = images.cvtColor(img, "BGR2GRAY");
  var 二值化图 = images.threshold(img, 135, 255, "BINARY");
  newImg = images.inRange(二值化图, "#000000", "#AAAAAA");
  images.save(newImg, "/sdcard/1.jpg", "jpg", 50);
  // media.scanFile("/sdcard/1.jpg");
  // app.viewFile("/sdcard/1.jpg");
  sleep(1000);
  二值化图.recycle();
  gray.recycle();
  img.recycle();
  let 位置 = getImgFingerprint(newImg);
  滑动检测(位置);
}

function getImgFingerprint(img) {
  let x, y, nums, value0, value1;
  for (x = 300; x < 920; x++) {
    nums = 0;
    for (y = 987; y < 1440; y++) {
      value0 = Number(images.pixel(img, x - 1, y)) != -1 ? 0 : 1;
      value1 = Number(images.pixel(img, x, y)) != -1 ? 0 : 1;
      if (value0 == 0 && value1 == 1 && ++nums > 25) {
        log("竖线横坐标" + x);
        if (x > device.width / 2) {
          return x;
        }
      }
    }
  }
  img.recycle();
}
/* 截图权限 */
function screenshotRequest() {
  console.log("开启截图权限");
  return threads.start(function () {
    while (true)
      if (text("立即开始").exists()) {
        sleep(500);
        Bounds(text("立即开始").findOne());
      } else if (text("允许").exists()) {
        sleep(500);
        Bounds(text("允许").findOne());
      }
  });
}

/**
 * 点击
 * @param {控件} obj
 */
function Bounds(obj) {
  try {
    obs = obj.bounds();
    click((Math.abs(obs.left) + Math.abs(obs.right)) / 2, (Math.abs(obs.top) + Math.abs(obs.bottom)) / 2);
  } catch (e) {
    Bounds(obj);
  }
}

function 滑动检测(x) {
  x = x || 550;
  let 请按照说明 = widgetGetOne("向右拖动.*");

  if (请按照说明) {
    let xy = 请按照说明.parent().bounds();
    log(xy.centerY() + " " + xy.left + " " + xy.right + " " + x);
    swipeEx(xy.left + 50, xy.centerY() - 20, x, xy.centerY() + 20, 1500); //向上滑动翻页

    // swipe(xy.left + 100, xy.centerY(), x - 100, xy.centerY() - 10, 600);
    // swipe(x - 100, xy.centerY() + 10, x, xy.centerY(), 600);
  }
}

function 找图(str, loop) {
  if (typeof loop === "undefined") {
    loop = 3;
  }
  var screen = images.captureScreen();
  screen = images.cvtColor(images.grayscale(screen), "GRAY2BGRA");
  var p = findImage(screen, images.fromBase64(str), { threshold: 0.6 });
  if (p) {
    toastLog("找到啦:" + p);
    let num = p.toString().replace(/{|}/g, "");
    let nums = num.split(",");
    click((nums[0] * 10) / 10, (nums[1] * 10) / 10);
    log("点击坐标：" + (nums[0] * 10) / 10 + " " + (nums[1] * 10) / 10);
    return true;
  } else if (loop-- > 1) {
    sleep(500);
    log("没查询到开始倒数第: b  " + loop + " 找图");
    return 找图(str, loop);
  } else {
    toastLog("没找到，找图失败");
    return false;
  }
}
exit();

/**
 * 根据内容获取一个对象
 *
 * @param {string} contentVal
 * @param {number} timeout 默认超时时间5秒
 * @param {boolean} containType 是否带回类型
 * @param {boolean} suspendWarning 是否隐藏warning信息
 * @param {function} appendFilter 附加查询条件 详见UiSelector
 */
function widgetGetOne(contentVal, timeout, containType, suspendWarning, appendFilter, options) {
  let target = null;
  let isDesc = false;
  let waitTime = timeout || 8000;
  let timeoutFlag = true;
  showFLog(["try to find one: {} timeout: {}ms", contentVal.toString(), waitTime]);
  let checkResult = widgetCheck(contentVal, waitTime, true, appendFilter, options);
  if (!checkResult.timeout) {
    timeoutFlag = false;
    target = checkResult.target;
    isDesc = checkResult.isDesc;
  }
  // 当需要带回类型时返回对象 传递target以及是否是desc
  if (target && containType) {
    let result = {
      target: target,
      bounds: target.bounds(),
      isDesc: isDesc,
      content: isDesc ? target.desc() : target.text(),
    };
    return result;
  }
  return target;
}

/**
 * 替换控件搜索算法DFS,BFS,VDFS,VBFS,PDFS,PBFS,PVDFS,PVBFS
 * DFS,BFS为默认提供的深度优先和广度优先搜索算法
 * VDFS,VBFS为我修改的只搜索可见控件（控件包括父级不可见则直接跳过）深度优先和广度优先搜索算法 缺点是无法搜索不可见控件，适合一个界面中有巨量控件的时候用于加快搜索速度 实际数据抖音极速版从25s缩短到3s
 * PDFS,PBFS,PVDFS,PVBFS 是通过多线程搜索控件 大大加快搜索速度
 *
 * @param {string} algorithm 搜索算法DFS,BFS,VDFS,VBFS,PDFS,PBFS,PVDFS,PVBFS
 * @param {UiSelector} mselector
 * @returns
 */
function wrapSelector(algorithm, appendFilter, mselector) {
  appendFilter =
    appendFilter ||
    function (matcher) {
      return matcher;
    };
  mselector = appendFilter(mselector || selector());
  if (!algorithm) {
    return mselector;
  }
  current = this.getCurrentAlgorithm();
  if (current == algorithm) {
    return mselector;
  }
  log(["替换搜索算法为：{} 原始算法：{}", algorithm, current]);
  return AlgorithmChanger.changeAlgorithm(mselector, algorithm);
}

/**
 * id检测
 * @param {string|RegExp} idRegex
 * @param {number} timeoutSetting
 */
function idCheck(idRegex, timeoutSetting, containType, appendFilter, options) {
  options = options || {};
  let timeout = timeoutSetting || 5000;
  let timeoutFlag = true;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let target = null;
  let idCheckThread = threads.start(function () {
    target = wrapSelector(options.algorithm, appendFilter).idMatches(idRegex).findOne();
    log("find id " + idRegex + " " + target.id());
    timeoutFlag = false;
    countDown.countDown();
  });

  let timeoutThread = threads.start(function () {
    sleep(timeout);
    countDown.countDown();
  });
  countDown.await();
  idCheckThread.interrupt();
  timeoutThread.interrupt();
  if (timeoutFlag) {
    log(["未能找到id:{}对应的控件", idRegex]);
  }
  if (containType) {
    return {
      timeout: timeoutFlag,
      target: target,
      bounds: target ? target.bounds() : null,
    };
  }
  return !timeoutFlag;
}

/**
 * 校验控件是否存在
 * @param {String} contentVal 控件文本
 * @param {Number} timeoutSetting 超时时间 单位毫秒
 * @param {Boolean} containType 返回结果附带文本是desc还是text
 * @param {Object} options 额外参数
 * 超时返回false
 */
function widgetCheck(contentVal, timeoutSetting, containType, appendFilter, options) {
  options = options || {};
  let timeout = timeoutSetting || 5000;
  let timeoutFlag = true;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let matchRegex = new RegExp(contentVal);
  let isDesc = false;
  let target = null;
  let descThread = threads.start(function () {
    target = wrapSelector(options.algorithm, appendFilter).descMatches(matchRegex).findOne();
    let res = target.desc();
    log("find desc " + contentVal + " " + res);
    timeoutFlag = false;
    isDesc = true;
    countDown.countDown();
  });

  let textThread = threads.start(function () {
    target = wrapSelector(options.algorithm, appendFilter).textMatches(matchRegex).findOne();
    let res = target.text();
    log("find text " + contentVal + "  " + res);
    timeoutFlag = false;
    countDown.countDown();
  });

  let timeoutThread = threads.start(function () {
    sleep(timeout);
    countDown.countDown();
  });
  countDown.await();
  descThread.interrupt();
  textThread.interrupt();
  timeoutThread.interrupt();
  if (timeoutFlag) {
    log("cannot find any matches " + contentVal + " timeout:" + timeout);
  }
  if (containType) {
    return {
      timeout: timeoutFlag,
      target: target,
      bounds: target ? target.bounds() : null,
      isDesc: isDesc,
    };
  }
  return !timeoutFlag;
}

/**
 * 根据id获取控件信息
 * @param {String|RegExp} idRegex id
 * @param {number} timeout 超时时间
 * @return 返回找到的控件，否则null
 */
function widgetGetById(idRegex, timeout, appendFilter, options) {
  options = options || {};
  timeout = timeout || 8000;
  let target = idCheck(idRegex, timeout, true, appendFilter, options);
  if (!target.timeout) {
    return target.target;
  } else {
    return null;
  }
}

// let result = widgetUtils.alternativeWidget(/\s*今日签到\s*/, '.*明早7点可领.*', null, true)
// if (result.value === 1) {
/**
 * 判断控件A或者控件B是否存在；超时返回0 找到A返回1 否则返回2
 *
 * @param {string|regex} contentA 控件A的内容
 * @param {string|regex} contentB 控件B的内容
 * @param {number} timeout 超时时间
 * @param {boolean} containContent 是否传递实际内容
 * @param {function} appendFilter 附加查询条件 详见UiSelector
 * @param {object} options 额外参数
 * @return 超时返回0 找到A返回1 否则返回2
 */
function alternativeWidget(contentA, contentB, timeout, containContent, appendFilter, options) {
  options = options || {};
  timeout = timeout || _config.timeout_existing;
  let timeoutFlag = true;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let matchRegexA = new RegExp(contentA);
  let matchRegexB = new RegExp(contentB);
  let isDesc = false,
    findA = false;
  let res = null,
    target = null;
  let descThreadA = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).descMatches(matchRegexA).findOne();
    res = target.desc();
    log("find desc " + contentA + " " + res);
    timeoutFlag = false;
    isDesc = true;
    findA = true;
    countDown.countDown();
  });

  let textThreadA = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).textMatches(matchRegexA).findOne();
    res = target.text();
    log("find text " + contentA + "  " + res);
    timeoutFlag = false;
    findA = true;
    countDown.countDown();
  });
  let descThreadB = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).descMatches(matchRegexB).findOne();
    res = target.desc();
    log("find desc " + contentB + " " + res);
    timeoutFlag = false;
    isDesc = true;
    countDown.countDown();
  });

  let textThreadB = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).textMatches(matchRegexB).findOne();
    res = target.text();
    log("find text " + contentB + "  " + res);
    timeoutFlag = false;
    countDown.countDown();
  });

  let timeoutThread = threads.start(function () {
    sleep(timeout);
    countDown.countDown();
  });
  countDown.await();
  descThreadA.interrupt();
  textThreadA.interrupt();
  descThreadB.interrupt();
  textThreadB.interrupt();
  timeoutThread.interrupt();
  if (timeoutFlag) {
    log(["cannot find any matches {} or {}", contentA, contentB]);
  }
  // 超时返回0 找到A返回1 否则返回2
  let returnVal = timeoutFlag ? 0 : findA ? 1 : 2;
  if (containContent) {
    return {
      target: target,
      bounds: target ? target.bounds() : null,
      content: res,
      value: returnVal,
    };
  } else {
    return returnVal;
  }
}

/**
 * 找到并且点击 如果返回错误就点击中心 返回一个布尔值
 * @param {str} 要找的字符串
 */
function findAndClick(str, sleepTime, waitSleep, isclick) {
  waitSleep = waitSleep || 300;
  sleep(waitSleep);
  sleepTime = sleepTime || 8000;
  let widgetGet = widgetGetOne(str, sleepTime);
  if (widgetGet) {
    clickView(widgetGet, isclick);
    return widgetGet;
  }
  return false;
}

function clickView(obj, isclick) {
  try {
    let 控件 = clickCenter(obj);
    if (控件 || isclick) {
      log("控件不能点击，或点击失败，查询点击父类");
      for (let i = 0; i < 4; i++) {
        if (obj && obj.clickable) {
          obj.click();
          console.log("Control clicked successfully" + obj.text());
        } else {
          console.log("Control not clickable, checking parent");
          obj = obj && obj.parent();
        }
      }
    }
  } catch (error) {
    console.error("按键点击失败：" + error);
  }
}
function clickCenter(obj) {
  console.hide();
  sleep(300);
  if (obj.bounds().centerX() > width || obj.bounds().centerY() > height || obj.bounds().centerX() < 0 || obj.bounds().centerY() < 0) {
    showFLog("不可点击范围:" + obj.bounds().centerX() + " " + obj.bounds().centerY());
    return true;
  }
  showFLog(obj.text() + " 点击位置：" + Number(obj.bounds().centerX()) + "," + Number(obj.bounds().centerY()));
  click(Math.floor(obj.bounds().centerX()), Math.floor(obj.bounds().centerY()));
  sleep(500);
}

function swipex(speed) {
  let millis = parseInt(speed || 500);
  let x = parseInt(width / 2);
  let startPoint = height / 2 - 150;
  // 滑动距离，二分之一屏幕
  let distance = parseInt(height / 2 - 260);
  let endPoint = startPoint - distance;
  // 手势上划
  log(startPoint + " " + endPoint);
  swipe(x, startPoint, x + 100, endPoint, millis);
}

function 等待并返回(等待时间) {
  if (等待时间) {
    sleep(Number(等待时间.text().replace(/[^\d]/g, "")) * 1000);
    back();
    sleep(1000);
    back();
  }
}

function showFLog(msgLog) {
  let str = msgLog + " ";
  setInfo(str);
  log(msgLog);
}
//================悬浮窗开始================
function FloatyUtil() {
  this.floatyWindow = null;
  this.floatyInitStatus = false;
  this.floatyLock = threads.lock();
  this.floatyCondition = this.floatyLock.newCondition();
}

function init() {
  if (this.floatyInitStatus) {
    return;
  }
  let _this = this;
  threads.start(function () {
    _this.floatyLock.lock();
    try {
      if (_this.floatyInitStatus) {
        return;
      }
      _this.floatyWindow = floaty.rawWindow(
        <frame gravity="left">
          <text id="content" textSize="16dp" textColor="#00ff00" bg="#000000" />
        </frame>
      );
      ui.run(function () {
        _this.floatyWindow.setTouchable(false);
        _this.floatyWindow.setPosition(150, 150);
        _this.floatyWindow.content.text("悬浮窗初始化成功");
      });
      _this.floatyInitStatus = true;
    } catch (e) {
      console.error("悬浮窗初始化失败" + e);
      _this.floatyWindow = null;
      _this.floatyInitStatus = false;
    } finally {
      _this.floatyCondition.signalAll();
      _this.floatyLock.unlock();
    }
  });
  _this.floatyLock.lock();
  try {
    if (_this.floatyInitStatus === false) {
      console.info("等待悬浮窗初始化");
      _this.floatyCondition.await();
    }
  } finally {
    _this.floatyLock.unlock();
  }
}

function setInfo(text, position, option) {
  option = option || {};
  if (this.floatyWindow === null) {
    this.init();
  }
  let _this = this;
  ui.run(function () {
    _this.floatyLock.lock();
    try {
      if (position && isFinite(position.x) && isFinite(position.y)) {
        _this.floatyWindow.setPosition(parseInt(position.x), parseInt(position.y) + 100);
      }
      if (text) {
        _this.floatyWindow.content.text(text);
      }
      if (option.textSize) {
        _this.floatyWindow.content.setTextSize(option.textSize);
      }
      if (typeof option.touchable !== "undefined") {
        _this.floatyWindow.setTouchable(option.touchable);
      }
    } finally {
      _this.floatyLock.unlock();
    }
  });
}
function idAndClick(str, sleepTime, istrue) {
  sleepTime = sleepTime || 8000;
  let widgetGet = widgetGetById(str, sleepTime);
  if (widgetGet) {
    clickView(widgetGet, istrue);
    return widgetGet;
  }
  return false;
}
function sleepT(num, str) {
  str = str || "";
  num = num || 1;
  for (let index = num; index > 0; index--) {
    showFLog("等待结束倒计时：" + index + "秒 " + str);
    sleep(1000);
  }
}
function 掌上武义阅读() {
  let 未完成 = className("Button").text("未完成").findOne(8000);

  while (未完成) {
    未完成.click();
    sleepT(5);
    idAndClick(".*itl_bottom_zan", 8000, true);
    idAndClick(".*left", 8000, true);
    // back();
    sleepT(3);
    swipex();
    sleepT(3);
    未完成 = className("Button").text("未完成").findOne(8000);
    // back();
  }
}

function 掌上武义f() {
  if (!app.launchApp("掌上武义")) {
    toastLog("未安装掌上武义，或者没有识别出来！");
    return;
  }
  findAndClick("打开|允许|跳过");
  findAndClick("签到有礼", 8000, 2000);
  findAndClick("惊喜.*", 18000, 2000, true);
  findAndClick(".*机会一.*", 8000, 2000);
  sleepT(3);
  掌上武义阅读();
  sleepT(3);
  back();
  swipex();
  sleepT(3);
  findAndClick(".*机会二.*");
  掌上武义阅读();
  findAndClick("1|2|3|4");

  findAndClick("抽奖.*");
  while (widgetGetOne("向右.*")) {
    滑块验证();
  }
  while (findAndClick("剩余.*")) {
    sleepT(5);
  }
  toastLog("任务结束");
  home();
}
//============================竞舟start======
function 竞舟阅读() {
  sleep(1000);
  swipex();
  let 未完成 = findAndClick("待完成", 8000, 1000, true);
  sleepT(3);
  if (未完成) {
    let 向右 = widgetGetOne("向右拖动.*");
    while (向右) {
      滑块验证();
      向右 = widgetGetOne("向右拖动.*");
    }
  }
  循环("竞舟返回()", 8);
  back();
}

function 竞舟返回() {
  sleepT(5, "5秒后返回");
  log(back());
  未完成 = findAndClick("待完成|剩余.*", 8000, 1000, true);
  if (!未完成 || /剩余/.test(未完成.text())) {
    sleepT(8, "等待抽奖");
    return true;
  }
}
function 竞舟f() {
  if (!launchApp("竞舟")) {
    return toastLog("没有安装竞舟");
  }
  findAndClick(".*跳过.*|打开|允许");
  sleepT(5);
  swipex();
  sleep(600);
  swipex();
  sleep(600);
  swipex();
  sleep(600);
  swipex();
  findAndClick("阅读有礼");
  findAndClick(".*下午.*", 16000, 1000, true);
  竞舟阅读();
  sleepT(3);
  swipex();
  findAndClick("剩余.*", 8000, 2000);
  // findAndClick("再.*");
  // findAndClick("抽奖.*");
  // back();
  // findAndClick("阅读有礼");
  sleepT(3);
  findAndClick(".*上午.*", 8000, 2000, true);
  竞舟阅读();
  sleepT(5);
  findAndClick("剩余.*");
  findAndClick("再.*");
  findAndClick("抽奖.*");
  home();
  toastLog("任务结束");
}
//============================竞舟end======

//============================爱盐海start======
function 爱盐海阅读(num) {
  sleep(1000);
  swipex();
  let 未完成 = findAndClick("待完成", 8000, 1000, true);
  sleepT(3);

  if (num) {
    let 向右 = widgetGetOne("向右拖动.*");
    while (向右) {
      滑块验证();
      向右 = widgetGetOne("向右拖动.*");
    }
  }
  循环("竞舟返回()", 6);
  back();
}

function 爱盐海f() {
  launchApp("爱海盐");
  findAndClick("打开|允许|跳过");
  sleepT(3);
  findAndClick("暂不升级");
  back();
  sleep(400);
  swipex();
  swipex();
  idAndClick(".*img_item");
  if (!findAndClick(".*阅读任务-3.*")) {
    back();
    sleep(2000);
    idAndClick(".*img_item");
    findAndClick(".*阅读任务-3.*");
  }
  爱盐海阅读(true);

  sleepT(3);
  swipex();
  findAndClick(".*阅读任务-2.*");
  爱盐海阅读();
  launchApp("爱海盐");
  sleep(1000);
  back();
  sleepT(3);
  swipex();
  findAndClick(".*阅读任务-1.*");
  爱盐海阅读();
  home();
  toastLog("任务结束");
}
//============================爱盐海end======

function 望潮f() {
  if (!launchApp("望潮")) {
    return toastLog("请先安装望潮");
  }
  findAndClick("打开|允许");
  findAndClick("跳过");
  sleepT(5, "等待加载页面");
  findAndClick(".*阅读有礼.*");
  sleepT(8);
  望潮阅读(true);

  home();
  toastLog("任务结束");
}

function 望潮阅读(num) {
  let 待完成 = text("待完成").find();
  待完成.forEach((v) => {
    v.parent().click();
    sleep(1000);

    back();
    sleep(2000);
  });
  findAndClick("抽奖");
  sleepT(10)
  let 点击抽奖 = widgetGetOne("抽奖记录");
  if (点击抽奖) {
    click(width / 2, 点击抽奖.bounds().centerY() / 2);
  }
}
//=================================
function 西施眼f() {
  launchApp("西施眼");
  findAndClick("跳过|打开|允许");
  sleepT(8, "等待加载阅读入口~");
  swipex();
  swipex();
  idAndClick(".*img_item");
  findAndClick(".*机会一.*|阅读有礼|红包.*", 8000, 2000, true);
  sleepT(3);
  掌上武义阅读();
  findAndClick("抽奖.*");
  while (widgetGetOne("向右.*")) {
    滑块验证();
  }
  sleepT(10);
  back();
  findAndClick(".*机会二.*", 8000, 2000, true);
  sleepT(3);
  掌上武义阅读();
  findAndClick("抽奖.*|剩余.*");
  sleepT(5);
}

//仿真随机带曲线滑动
//qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,过程耗时单位毫秒
function swipeEx(qx, qy, zx, zy, time) {
  var xxy = [time];
  var point = [];
  var dx0 = {
    x: qx,
    y: qy,
  };

  var dx1 = {
    x: random(qx - 100, qx + 100),
    y: random(qy, qy + 50),
  };
  var dx2 = {
    x: random(zx - 100, zx + 100),
    y: random(zy, zy + 50),
  };
  var dx3 = {
    x: zx,
    y: zy,
  };
  for (var i = 0; i < 4; i++) {
    eval("point.push(dx" + i + ")");
  }

  for (let i = 0; i < 1; i += 0.08) {
    xxyy = [parseInt(bezier_curves(point, i).x), parseInt(bezier_curves(point, i).y)];

    xxy.push(xxyy);
  }

  gesture.apply(null, xxy);
}

function bezier_curves(cp, t) {
  cx = 3.0 * (cp[1].x - cp[0].x);
  bx = 3.0 * (cp[2].x - cp[1].x) - cx;
  ax = cp[3].x - cp[0].x - cx - bx;
  cy = 3.0 * (cp[1].y - cp[0].y);
  by = 3.0 * (cp[2].y - cp[1].y) - cy;
  ay = cp[3].y - cp[0].y - cy - by;

  tSquared = t * t;
  tCubed = tSquared * t;
  result = {
    x: 0,
    y: 0,
  };
  result.x = ax * tCubed + bx * tSquared + cx * t + cp[0].x;
  result.y = ay * tCubed + by * tSquared + cy * t + cp[0].y;
  return result;
}
function 循环(str, num) {
  for (let i = 0; i < num; i++) {
    if (eval(str)) {
      showFLog("满足退出条件，退出");
      break;
    }
  }
}
